The present invention relates to a semiconductor memory and, more particularly, to a semiconductor memory having a security function for preventing programming (writing), erasing and reading of a nonvolatile memory.
An EEPROM (Electrically Erasable and Programmable Read Only Memory) is a nonvolatile memory and is therefore electrically erasable and programmagle. However, one concern with such a memory is that data to be protected might be rewritten. To protect the data stored in such a non-volatile memory, a method has already been proposed wherein a security bit is employed and any external access to the nonvolatile memory is inhibited in accordance with the state of the security bit (for example, see "Electronics Design", Mar. 3, 1983, pp. 123 to 128). More specifically, a write-only security register which is separate from a normal memory block is prepared, and any access to the normal memory block is inhibited in accordance with the state of the security bit. In such case, the following method may be employed for forming a write-only security register by an EEPROM. Namely, the erasing operation of the security register is allowed only when the whole of the normal memory block is erased. Thus, after the security register has been programmed so as to protect the normal memory block, it is impossible to access the normal memory block unless the data stored in the normal memory block is destroyed. In this method, however, no consideration is taken for the security function for preventing rewriting of data once programmed. In addition, since erasing and programming conditions for an EEPROM constituting a security register differ from those for a normal memory block, the security register must be provided with independent erasing and programming circuits, which leads to a complicated circuit configuration. Further, since the security function of the above-described method is carried out for the entire memory as one unit, it is not possible to control the security function for each of the divided portions of the memory, each divided portion having a relatively small capacity.
There is another conventional memory protecting method in which a region to be protected and contents to be protected are designated by software. This method, however, requires another memory for storing such data and contents to be protected, together with system software, which leads to an increase in size or scale of the memory device as a whole. Therefore, this method is not suitable for data protection of a nonvolatile memory or the like which has a relatively small memory capacity.
A microcomputer which is applied to, for example, a cash card and which incorporates a nonvolatile memory is demanded wherein the nonvolatile memory should be divided into a plurality of areas which are respectively used for various purposes, such as a program storing area, ID code storing area and data storing area. In this case, for realization of a highly reliable system, it is very important to enable inhibition of reading, programming (writing) and erasing for each of the divided areas each constituted by a small region.